package com.hszl.blog.utils;

import com.hszl.blog.dao.pojo.SysUser;
import org.springframework.stereotype.Component;

/**
 * @author: 胡爽
 * @date: 2022/5/30 15:32
 **/
public class UserThreadLocal {
    private UserThreadLocal(){}
    //线程变量隔离
    private static final ThreadLocal<SysUser> LOCAL = new ThreadLocal<>();

    public static void put(SysUser sysUser){
        LOCAL.set(sysUser);
    }
    public static SysUser get(){
        return LOCAL.get();
    }
    public static void remove(){
        LOCAL.remove();
    }
}
